package com.funo.wcity.app.service.mail.send;

import java.util.Properties;

import javax.mail.Session;


/**
 * 类说明：用于创建session
 * 
 * @author 作者: 李刚
 * @version 创建时间：2011-7-22 下午11:46:09
 */
public class MailSession {
	/**
	 * 创建session
	 * 
	 * @param props
	 *            属性配置
	 * @param auth
	 *            用户认证
	 * @return Session 对象
	 */
	public static Session createSession(MailAuthenticator auth,String pop,String smtp) {
		Session session = null;
		Properties props = new Properties();
		props.put("mail.smtp.host", smtp);
		props.put("mail.store.host",pop);
		session = Session.getInstance(props, auth);
		return session;
	}
	// 得到Session对象
	public static Session getInstance(String pop,String smtp) {
		Properties props=new Properties();
		props.put("mail.smtp.host", smtp);
		props.put("mail.store.host",pop);
		return Session.getInstance(props);
	}
}
